package belf.migrate.engine.job.cdc;

import belf.migrate.api.common.JobMode;
import belf.migrate.api.job.Job;
import belf.migrate.api.taskconf.TaskConf;
import belf.migrate.core.util.LoadLogger;
import belf.migrate.engine.BelfEvn;
import belf.migrate.api.taskconf.Task;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

/**
 * CDCJobRunner的测试类，在开发调试时很方便，可用于跟踪CDC任务执行流程
 */
@Slf4j
public class OracleCDCJobRunnerTest {
    public static void main(String[] args) {
        LoadLogger.initLog();

        String sourceDBCatalog = "ORACLE";
        String sinkDBCatalog = "DAMENG";
        int taskId = 2;

        TaskConf taskConf = BelfEvn.getInstance().getTaskConf(sourceDBCatalog + "-" + sinkDBCatalog + "-" + taskId);
        log.info("found valid TaskConf: {}", taskConf);
        Task task = new Task(taskId,
                "ORACLE-DAMENG",
                "ORACLE数据导入到达梦库",
                "lpf",
                new Date(),
                taskConf,
                Task.TaskType.SYNC_DATA,
                null,
                JobMode.STREAMING,
                Task.TaskPolicy.ERROR_STOP);
        Job job = new Job(task, 200, new Date(), new Date());
        new CDCJobRunner(job).execute();
    }
}
